<?
	define('_VIEW_MODEL_','admin');
	session_start();
	$statu = $_SESSION['statu'];
	require_once '../init.php';
	$info = false;
	$fir  = false;
	if(!$statu){
		echo "<script>window.parent.location.href='./index.php'</script>";
	}
	if(isset($act)&&$act=="update"){
		$id = intval($id);
		$nu = intval($value);
		$db->Execute("update {$telper}bbs_column set `rank`='$nu' where `id` = '$id'");
	}
	if(isset($act)&&$act=="upst"){
		$id = intval($id);
		$nu = intval($value);
		$st = $nu == 0?'1':'0';
		$db->Execute("update {$telper}bbs_column set `state`='$st' where `id` = '$id'");
	}
	$rs = $db->Execute("select * from {$telper}bbs_column order by rank desc,id asc");
	$in = $rs->GetArray();
	if(!empty($rs)){
		foreach($in as $k=>$v){
			if($v['pid'] == 0){
				$fir[] = $v;
			}else{
			 	$info[$v['pid']][] = $v;
			}
		}
	}
	$smartyObj->assign("title",$admintitle);
	$smartyObj->assign("adminproplist",$adminbbslist);
	$smartyObj->assign("info",$info);
	$smartyObj->assign("fir",$fir);
	$smartyObj->display("bbscontlist.tpl");
?>